//
//  KARepaymentRecordCell.swift
//  kano
//
//  Created by Frank on 2024/10/12.
//

import UIKit

class KARepaymentRecordCell: UITableViewCell {
    
    var BLOCK_block: ((String) -> Void)?
    
    lazy var var_amountLabel: UILabel = {
        let var_amountLabel = UILabel()
        var_amountLabel.font = UIFont.systemFont(ofSize: kscale(16), weight: .bold)
        var_amountLabel.textColor = .black
        var_amountLabel.text = ""
        return var_amountLabel
    }()
    
    lazy var var_timeLabel: UILabel = {
        let var_timeLabel = UILabel()
        var_timeLabel.font = UIFont.systemFont(ofSize: kscale(12), weight: .regular)
        var_timeLabel.textColor = .color8A8891
        var_timeLabel.text = ""
        return var_timeLabel
    }()
    
    lazy var var_statusLabel: UILabel = {
        let var_statusLabel = UILabel()
        var_statusLabel.font = UIFont.systemFont(ofSize: kscale(14), weight: .regular)
        var_statusLabel.textColor = .themeColor
        var_statusLabel.text = ""
        return var_statusLabel
    }()
    
    lazy var var_tipLabel: UILabel = {
        let var_tipLabel = UILabel()
        var_tipLabel.font = UIFont.systemFont(ofSize: kscale(12), weight: .regular)
        var_tipLabel.textColor = .color8A8891
        var_tipLabel.text = ""
        return var_tipLabel
    }()
    
    lazy var var_lineView: UIView = {
        let var_lineView = UIView()
        var_lineView.backgroundColor = .colorE2E1E3
        return var_lineView
    }()
    
    //MARK: -init
    static func ka_cell(for tableView: UITableView) -> KARepaymentRecordCell {
        let var_identifityId = NSStringFromClass(self)
        var var_cell = tableView.dequeueReusableCell(withIdentifier: var_identifityId)
        if var_cell == nil {
            var_cell = KARepaymentRecordCell.init(style: .default, reuseIdentifier: var_identifityId)
        }
        return var_cell as! KARepaymentRecordCell
    }
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.ka_setUI()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func ka_setUI() {
        selectionStyle = .none
        contentView.addSubview(var_amountLabel)
        contentView.addSubview(var_timeLabel)
        contentView.addSubview(var_statusLabel)
        contentView.addSubview(var_lineView)
        contentView.addSubview(var_tipLabel)
        
        
        var_amountLabel.snp.makeConstraints { make in
            make.left.equalTo(kscale(12))
            make.top.equalTo(kscale(16))
        }
        
        var_timeLabel.snp.makeConstraints { make in
            make.left.equalTo(var_amountLabel.snp.left)
            make.top.equalTo(var_amountLabel.snp.bottom).offset(kscale(12))
        }
        
        var_statusLabel.snp.makeConstraints { make in
            make.centerY.equalTo(contentView)
            make.right.equalTo(contentView).offset(kscale(-12))
        }
        
        var_tipLabel.snp.makeConstraints { make in
            make.top.equalTo(var_timeLabel.snp.top)
            make.right.equalTo(contentView).offset(kscale(-12))
        }
        
        var_lineView.snp.makeConstraints { make in
            make.left.equalTo(kscale(12))
            make.right.equalTo(kscale(-12))
            make.height.equalTo(1)
            make.top.equalTo(1)
        }
    }
}
